/*
 *  ScalaSwingSet
 *  Copyright (c) 2008 Andy Hicks. All rights reserved.
 *  http://www.scalalabs.org
 *
 *  This software is released under the terms of the Revised BSD License.
 *  There is NO WARRANTY. See the file LICENSE for the full text.
 */
package com.scalalabs.scalaswingset


import scala.swing.{MainFrame, BorderPanel, SimpleGUIApplication, SplitPane, Swing, Orientation}
import javax.swing.UIManager
import BorderPanel.Position._

object ScalaSwingSet extends SimpleGUIApplication {

  val MAIN_FRAME_WIDTH = 880
  val MAIN_FRAME_HEIGHT = 640
  val DEMO_SELECTOR_WIDTH = 186
  val DEMO_PANEL_HEIGHT = 400
  val DEMO_PANEL_WIDTH = MAIN_FRAME_WIDTH - DEMO_SELECTOR_WIDTH;

//  val Array[String /*Demo*/] demoList

  def top = new MainFrame {
    title = "ScalaSwingSet"
//    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel")
    contents = createMainPanel()

  }



  override def main(args: Array[String]) = {
    super.main( args )
  }


  def createMainPanel(): BorderPanel = {
    new BorderPanel()  {
      val demoSelectorPanel = new DemoSelectorPanel("GUI Components"/*, demoList*/) {
        preferredSize = (DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT)
//        demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener());
      }
      layout(demoSelectorPanel) = West

      layout( new AnimatingSplitPane(Orientation.Vertical) {
        topComponent = new BorderPanel() {
          border = Swing.EmptyBorder(10, 10, 10, 10)
          preferredSize = (DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT)

          layout( new IntroPanel()) = Center
        }
        bottomComponent = new BorderPanel() {
 //         minimumSize = (0,0)
          border = Swing.EmptyBorder(10, 10, 10, 10)
          val codeViewer = new CodeViewer()
          layout(codeViewer) = Center

        }
      }) = Center

    }


    
  }

}